import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-05-16
 * Time: 17:55
 */
public class UserForm {
    private static HashMap<String,String> hashMap=new HashMap<>();

    public static void set(String username,String password) {
        hashMap.put(username,password);
    }
    public static void show(){
        String string = hashMap.toString();
        System.out.println(string);
    }

    public static boolean isUsername(String username) {
        // 这里应该与存储的用户数据进行比较
        // 仅为示例，这里直接返回true
        return hashMap.containsKey(username);
    }
    public static boolean  isValidUser(String username, String password) {
        // 这里应该与存储的用户数据进行比较
        // 仅为示例，这里直接返回true
        String tmp="";
        if (hashMap.containsKey(username)){
            tmp=hashMap.get(username);
        }else {
            return false;
        }
        if (tmp.equals(password)){
            return true;
        }
        return false;
    }
}
